from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
# from selenium.webdriver.common.action_chains import ActionChains
def main():
    options = webdriver.EdgeOptions()
    options.add_experimental_option("detach", True)
    # 使用Firefox浏览器
    driver = webdriver.Edge(options = options)
    driver.maximize_window() 
    # 访问登录页面
    driver.get("http://10.0.108.4:3000")
     
    # 定位用户名输入框
    print(dir(driver))
    username = driver.find_element(By.ID,"username")
    username.send_keys("mahongquan")
     
    # 定位密码输入框
    password = driver.find_element(By.ID,"password")
    password.send_keys("mhq730208[]")
     
    # 定位登录按钮并点击
    login_button = driver.find_element(By.CLASS_NAME,"login-button")
    login_button.click()
    time.sleep(2)
    # selector='body > div:nth-child(10) > div > div > ul > li:nth-child(2) > span'
    #标准库管理
    selector='#app > section > aside > div > ul > li:nth-child(6)'
    a1 = driver.find_element(By.CSS_SELECTOR,selector)
    a1.click()
    time.sleep(2)
    #模板管理
    selector='body > div:nth-child(6) > div > div > ul > li:nth-child(2) > span'
    a2 = driver.find_element(By.CSS_SELECTOR,selector)
    a2.click()
    time.sleep(5)
    #原始记录单
    sel="#app > section > section > main > div:nth-child(3) > div > div > div > div > div > div:nth-child(2) > div.ant-col.ant-col-4 > div > ul > li:nth-child(3)"
    yuanshi = driver.find_element(By.CSS_SELECTOR,selector)
    driver.execute_script("arguments[0].click", yuanshi)
